package com.wcar.sso.feign.factory;

import com.wcar.common.entity.User;
import com.wcar.sso.feign.UserFeign;
import com.wcar.common.vo.Result;
import feign.hystrix.FallbackFactory;
import org.springframework.stereotype.Component;

@Component
public class UserFeignFactory implements FallbackFactory<UserFeign> {
    @Override
    public UserFeign create(Throwable throwable) {
        return new UserFeign() {
            @Override
            public Result<User> selectByName(String name) {
                return new Result<User>(500,throwable.getMessage(),null);
            }
        };

    }
}
